package typejump.commands;

import typejump.AnimationManager;
import typejump.Swagger;
import typejump.TypeJump;
import typejump.engine.GameEngine;
import typejump.engine.OnGoingThing;
import typejump.objects.AttachableSparkles;
import typejump.objects.Sparkles;


public class DevInfiniteSwag implements TextCommand, OnGoingThing {

	Sparkles sparkles;
	
	@Override
	public boolean matches(String command) {
		return command.equals("dev infinite swag");
	}

	@Override
	public void act(String command) {
		Swagger.getInst().setInfiniteSwag(true);
		GameEngine.addTextEffect("SWAG IS INFINITE", "dev");
		

		if (sparkles != null)
			sparkles.stopSparkling();
		sparkles = new AttachableSparkles(GameEngine.getPlayer(), AnimationManager.SPARKLE_RAINBOW, 0);
		sparkles.setSpeedX(-30, 30);
		
		GameEngine.addEffect(sparkles);
		GameEngine.addOnGoingThing(this);
	}

	@Override
	public boolean happen(TypeJump tj, double seconds) {
		if (!Swagger.getInst().hasInfiniteSwag()) {
			sparkles.stopSparkling();
			return true;
		}
		return false;
	}

}
